this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,i){"use strict";var a,n,r,l,o;var s=Symbol("depth");var u=Symbol("onHeaderClick");var d=Symbol("onTextChange");var h=function(e){babelHelpers.inherits(i,e);function i(){var e;var a=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,i);e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(i).call(this,a));e.setEventNamespace("BX.Landing.UI.Form.MenuItemForm");e.cache=new t.Cache.MemoryCache;e[u]=e[u].bind(babelHelpers.assertThisInitialized(e));e[d]=e[d].bind(babelHelpers.assertThisInitialized(e));e.onRemoveButtonClick=e.onRemoveButtonClick.bind(babelHelpers.assertThisInitialized(e));t.Dom.addClass(e.layout,"landing-ui-form-menuitem");t.Dom.append(e.getHeaderLeftLayout(),e.header);t.Dom.append(e.getHeaderRightLayout(),e.header);e.setDepth(a.depth);var n=babelHelpers.slicedToArray(e.fields,1),r=n[0];if(r){var l=r.getValue(),o=l.text;e.setTitle(o);t.Event.bind(r.input.input,"input",e[d])}t.Event.bind(e.getHeader(),"click",e[u]);return e}babelHelpers.createClass(i,[{key:u,value:function e(t){t.preventDefault();if(this.isFormShown()){this.hideForm()}else{this.showForm()}}},{key:d,value:function e(){var t=babelHelpers.slicedToArray(this.fields,1),i=t[0];if(i){var a=i.getValue(),n=a.text;this.setTitle(n)}}},{key:"onRemoveButtonClick",value:function e(){this.emit("remove",{form:this});t.Dom.remove(this.layout)}},{key:"showForm",value:function e(){t.Dom.addClass(this.layout,"landing-ui-form-menuitem-open");t.Dom.style(this.body,"display","block")}},{key:"hideForm",value:function e(){t.Dom.removeClass(this.layout,"landing-ui-form-menuitem-open");t.Dom.style(this.body,"display",null)}},{key:"isFormShown",value:function e(){return t.Dom.style(this.body,"display")!=="none"}},{key:"getDragButton",value:function e(){return this.cache.remember("dragButton",(function(){return t.Tag.render(a||(a=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-form-header-drag-button landing-ui-drag"></div>\n\t\t\t'])))}))}},{key:"getTitleLayout",value:function e(){var i=this;return this.cache.remember("titleLayout",(function(){return t.Tag.render(n||(n=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-form-header-title">',"</div>\n\t\t\t"])),t.Text.encode(i.title))}))}},{key:"getHeaderLeftLayout",value:function e(){var i=this;return this.cache.remember("headerLeftLayout",(function(){return t.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-form-header-left">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),i.getDragButton(),i.getTitleLayout())}))}},{key:"getRemoveButton",value:function e(){var i=this;return this.cache.remember("removeButton",(function(){var e=t.Tag.render(l||(l=babelHelpers.taggedTemplateLiteral(['<div class="landing-ui-form-header-remove-button"></div>'])));t.Event.bind(e,"click",i.onRemoveButtonClick);return e}))}},{key:"getHeaderRightLayout",value:function e(){var i=this;return this.cache.remember("headerRightLayout",(function(){return t.Tag.render(o||(o=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-form-header-right">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),i.getRemoveButton())}))}},{key:"setTitle",value:function e(i){if(t.Type.isString(i)||t.Type.isNumber(i)){this.title=i;this.getTitleLayout().innerText=t.Text.decode(i)}}},{key:"setDepth",value:function e(i){var a=20;this[s]=t.Text.toNumber(i);t.Dom.style(this.layout,"margin-left","".concat(i*a,"px"));t.Dom.attr(this.layout,"data-depth",i)}},{key:"getDepth",value:function e(){return t.Text.toNumber(t.Dom.attr(this.layout,"data-depth"))}},{key:"serialize",value:function e(){var t=babelHelpers.slicedToArray(this.fields,1),i=t[0];return i.getValue()}}]);return i}(i.BaseForm);e.MenuItemForm=h})(this.BX.Landing.UI.Form=this.BX.Landing.UI.Form||{},BX,BX.Landing.UI.Form);
//# sourceMappingURL=menuitemform.bundle.map.js